package com.alibaba.citrus.ots.platform.enhance.sdo;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;

/**
 * @author zhoubc
 * @description: TODO
 * @date 2021/9/6 13:20
 */
public enum CommStatusEnum {

    ENABLE(1,"启用"),

    DISABLE(-1, "禁用");

    @Getter
    @Setter
    private int code;

    @Getter
    @Setter
    private String desc;

    CommStatusEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static CommStatusEnum of(Integer code) {
        if (code == null) {
            return null;
        }
        return Arrays.stream(CommStatusEnum.values()).filter(source -> code == source.code).findFirst().orElse(null);
    }
}
